//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package org.quickserver.net.client;

import java.security.KeyStore;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;

public class DummyTrustManager implements X509TrustManager {
    private static DummyTrustManager instance;
    private X509TrustManager sunJSSEX509TrustManager;

    static {
        try {
            instance = new DummyTrustManager();
        } catch (Throwable var1) {
            ;
        }

    }

    public static DummyTrustManager getInstance() {
        return instance;
    }

    public DummyTrustManager() throws Exception {
        TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
        KeyStore ks = null;
        tmf.init((KeyStore)null);
        TrustManager[] tms = tmf.getTrustManagers();

        for(int i = 0; i < tms.length; ++i) {
            if (tms[i] instanceof X509TrustManager) {
                this.sunJSSEX509TrustManager = (X509TrustManager)tms[i];
                break;
            }
        }

        if (this.sunJSSEX509TrustManager == null) {
            throw new Exception("Couldn't initialize");
        }
    }

    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        try {
            this.sunJSSEX509TrustManager.checkClientTrusted(chain, authType);
        } catch (CertificateException var4) {
            throw var4;
        }
    }

    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        try {
            this.sunJSSEX509TrustManager.checkServerTrusted(chain, authType);
        } catch (CertificateException var4) {
            ;
        }

    }

    public X509Certificate[] getAcceptedIssuers() {
        return this.sunJSSEX509TrustManager == null ? null : this.sunJSSEX509TrustManager.getAcceptedIssuers();
    }
}
